<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>更新用户登陆日志表</title>
</head>
<body>
<form>
    <table border="1">
        <tr><td colspan="2"><h1>更新用户登陆日志表内容</h1></td></tr>
        <tr>
            <td>登陆日志ID</td>
            <td>
                    <span id="loginId_txt"></span><input type="hidden" id="loginId" name="loginId"/>
            </td>
        </tr>
        <tr>
            <td>登陆用户ID</td>
            <td>
                    <input type="text" id="customerId" name="customerId"/>
            </td>
        </tr>
        <tr>
            <td>用户登陆时间</td>
            <td>
                    <input type="text" id="loginTime" name="loginTime"/>
            </td>
        </tr>
        <tr>
            <td>登陆IP</td>
            <td>
                    <input type="text" id="loginIp" name="loginIp"/>
            </td>
        </tr>
        <tr>
            <td>登陆类型：0未成功，1成功</td>
            <td>
                    <input type="text" id="loginType" name="loginType"/>
            </td>
        </tr>
        <tr>
            <td>其他</td>
            <td>
                    <input type="text" id="other1" name="other1"/>
            </td>
        </tr>
        <tr>
            <td>其他</td>
            <td>
                    <input type="text" id="other2" name="other2"/>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" id="tijiao" value="提交"/>
                <input type="reset" value="重置"/>
            </td>
        </tr>
    </table>
</form>
<script src="/js/jquery-1.12.4.js"></script>
    <script>
    var param = location.href.substring(location.href.indexOf('?')+1);
    $.getJSON("/customerloginlog/findById.json",param,function(detail){
        $("#loginId_txt").text(detail.loginId);
        $("#loginId").val(detail.loginId);
        $("#customerId").val(detail.customerId);
        $("#loginTime").val(detail.loginTime);
        $("#loginIp").val(detail.loginIp);
        $("#loginType").val(detail.loginType);
        $("#other1").val(detail.other1);
        $("#other2").val(detail.other2);
    });
    //点击提交按钮
    $("#tijiao").click(function(){
        if(!$("#customerId").val()){
            alert("登陆用户ID不能为空");
            return;
        }
        if(!$("#loginTime").val()){
            alert("用户登陆时间不能为空");
            return;
        }
        if(!$("#loginIp").val()){
            alert("登陆IP不能为空");
            return;
        }
        if(!$("#loginType").val()){
            alert("登陆类型：0未成功，1成功不能为空");
            return;
        }
        if(!$("#other1").val()){
            alert("其他不能为空");
            return;
        }
        if(!$("#other2").val()){
            alert("其他不能为空");
            return;
        }
        
        $.post("/customerloginlog/update.json",$("form").serialize(),function(result){
            if(result.flag==true){
                alert(result.msg);
                location.href="/admin/customerloginlog/list.html";
            }else{
                alert(result.msg);
            }
        })

    })
</script>

</body>
</html>